package handlers

import (
	"github.com/gin-gonic/gin"
	"pic-text-mgr/models"
)

func Requst(c *gin.Context) {
	username := c.PostForm("username")
	password := c.PostForm("password")

	data := models.User{
		Username: username,
		Password: password,
	}
	models.DB.Create(&data)
	if data.ID == 0 {
		c.JSON(200, gin.H{
			"code": 500,
			"msg":  "查询用户不存在",
		})
	}
	c.JSON(200, gin.H{
		"code": 200,
		"msg":  "注册成功",
	})
	return
}
